class Solution:

    def calcunate(self, i ):
        if i in self.temp:
            return self.temp[i]
        if i == 0: return 0
        if i == 1: return 0
        if i not in self.temp:
            t1= self.calcunate(i - 1 ) + self.cost[i - 1]
            t2= self.calcunate(i - 2 ) + self.cost[i - 2]
            self.temp[i]=min(t1, t2)
            return  self.temp[i]

    def minCostClimbingStairs(self, cost):
        self.temp={}
        self.cost=cost
        return self.calcunate(len(cost))